using System;
using System.Threading.Tasks;
using Ppbr.Dtos;
using Qmtq.Qmtq;
using Qmtq.Qmtq.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;

namespace Ppbr
{
    public class Ppbr001AppService : CrudAppService<Ppbr001, Ppbr001Dto, Guid, PagedAndSortedResultRequestDto, CreatePpbr001Dto, UpdatePpbr001Dto>,
        IPpbr001AppService
    {
        private readonly IPpbr001Repository _repository;
        private readonly Itqmtq100AppService _itqmtq100AppService;

        public Ppbr001AppService(IPpbr001Repository repository, Itqmtq100AppService appService) : base(repository)
        {
            _repository = repository;
            _itqmtq100AppService = appService;
        }

        public async Task<Guid> CallQmtq()
        {
            var dto = new Createtqmtq100Dto { ENTRNO = "3333" , HEATNO="222vs", RLNO="vssff"};
            var created =  await _itqmtq100AppService.CreateAsync(dto);
            return created.Id;
        }

        public async Task<bool> CallQmtq2()
        {
            var ppbrdto = await this.CreateAsync(new CreatePpbr001Dto() {  HEATNO = "0000", MATLEN =1111, MATNO ="222", MATTHICK = 1111, MATWIDTH =333, MATWT =888, MSCLINENO="00000", SGSIGN= "222", STNO="333" });
            var dto = new Createtqmtq100Dto { ENTRNO = "3333", HEATNO = "222vs", RLNO = ppbrdto.Id.ToString() };
            var created = await _itqmtq100AppService.Insert_Test(dto);
            return created;
        }
    }
}